home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 676-700 / 680 / sattrack / ifflib20.lzh / Examples / Grabber.S < prev    next >
Text File  |  1990-07-31  |  2KB  |  54 lines

  1. * Simple Picture Grabber by CHH & CHW
  2. * This program saves the contents of the first screen as an IFF file
  3. * with filename 'RAM:grabber.pic'. The iff.library is required.
  4. * If you use the DevPac assembler, type 'Genim2 Grabber' to assemble.
  5. * For simplicity, this program uses hard coded constants. You may wish
  6. * to use the appropriate standard header files instead.
  7.  
  8. Main:        move.l    4,a6            ; AbsExecBase
  9.         lea    IFFName(PC),a1        ; Library Name
  10.         moveq    #16,d0            ; Required library version
  11.         jsr    -552(a6)        ; OpenLibrary()
  12.         move.l    d0,a4            ; A4 : IFF Library Base
  13.         tst.l    d0            ; Did we get it ?
  14.         bne.s    IFFOpen            ; Yes --->
  15.         moveq    #20,d0            ; Return-code RETURN_FAIL
  16.         rts                ; Return to CLI
  17. IFFOpen:
  18.         lea    IntuiName(PC),a1    ; Intuition Library Name
  19.         jsr    -408(a6)        ; OldOpenLibrary()
  20.         move.l    d0,a5            ; A5 : IntuitionBase
  21.  
  22.         move.l    60(a5),a0        ; IntuitionBase->FirstScreen
  23.         move.l    88(a0),d6        ; Screen.BitMap
  24.  
  25.         move.l    48(a0),a1        ; struct Colormap
  26.         move.l    4(a1),d7        ; struct ColorTable
  27.         lea    44(a0),a1        ; sc_ViewPort
  28.         move.w    32(a1),d1        ; vp_Modes
  29.         moveq    #1,d0            ; Set cruncher-flag
  30.         btst    #11,d1            ; Hold And Modify ?
  31.         beq.s    NoHam            ; no --->
  32.         bset    #7,d0            ; Set HAM-Flag for IFF.lib
  33. NoHam:
  34.         move.l    a4,a6            ; IFFBase
  35.         lea    FileName(PC),a0        ; Name of file to save
  36.         move.l    d6,a1            ; Pointer to BitMap
  37.         move.l    d7,a2            ; Pointer to ColorMap
  38.         jsr    -66(a6)            ; SaveBitMap()
  39.  
  40.         move.l    4,a6            ; AbsExecBase
  41.         move.l    a4,a1            ; IFFBase
  42.         jsr    -414(a6)        ; CloseLibrary() (IMPORTANT!)
  43.  
  44.         move.l    a5,a1            ; IntuitionBase
  45.         jsr    -414(a6)        ; CloseLibrary()
  46.  
  47.         moveq    #0,d0            ; DOS return code
  48.         rts
  49.  
  50. IFFName:    dc.b    "iff.library",0
  51. IntuiName:    dc.b    "intuition.library",0
  52. FileName:    dc.b    "RAM:grabber.pic",0
  53.  
  54.